package com.eb.bi.common.util;

import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;

public class FileProcessor {
	String m_errorDesc;
	public String getM_errorDesc() {
		return m_errorDesc;
	}
	public StringBuffer getTotalFileInfo(String filePath) {
		try {
			FileReader fr = new FileReader(filePath);
			BufferedReader br = new BufferedReader(fr);
			StringBuffer sb = new StringBuffer();
			String tempS = "";
			try {
				while ((tempS = br.readLine()) != null) {
					sb.append(tempS);
				}
				if(sb.equals("")){
					m_errorDesc = "file content is empty";
					return null;
				}
				return sb;
			} catch (IOException e) {
				m_errorDesc = "IOException";
				return null;
			}

		} catch (FileNotFoundException e) {
			m_errorDesc = "file not found exception";
			return null;
		}
	}
}
